package com.gsm.aware;

import com.gsm.entity.Person;
import com.gsm.log.MyLogger;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class MyApplicationContextAware implements ApplicationContextAware {

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		Person bean = applicationContext.getBean(Person.class);
		String applicationName = applicationContext.getApplicationName();
		MyLogger.log(applicationName);
		MyLogger.log("ApplicationContextAware", bean);
		MyLogger.separator();
	}
}
